﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using affx_powertools_comLib;
using System.Runtime.InteropServices;

namespace proyecto
{
    class AffymetrixParser
    {
        public static void Parse(string strAlgorithm, string strCELFilesList, string strCDFFile, string strOutputFolder)
        {
            
            // "RMA" => "rma-sketch"
            // "PLIER" => "quant-norm.sketch=-1.bioc=false,pm-only,plier"
            // "MAS5" => "mas5-bg,pm-only,mas5-signal"

            /*string strAlgorithm = args[0];
            string strCELFilesList = args[1];
            string strCDFFile = args[2];
            string strOutputFolder = args[3];*/
            enumOutputType enOutputType = enumOutputType.otNone;
            
            try
            {
                
                IAffymetrixPowerTools affymetrixPowerTools = CreateAffymetrixPowerTools();
                
                affymetrixPowerTools.ProbesetSummarize(strAlgorithm, strCELFilesList, strCDFFile, enOutputType, strOutputFolder);
                
                Marshal.ReleaseComObject(affymetrixPowerTools);

                affymetrixPowerTools = null;

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                throw e;
            }

        }

        #region Imports

        [DllImport("../../lib/affx_powertools_com.dll", EntryPoint = "CreateAffymetrixPowerTools")]
        public static extern IAffymetrixPowerTools CreateAffymetrixPowerTools();

        #endregion // Imports
    }
}
